#include"udp_client.hpp"
#include<iostream>
#include<cstdlib>

int main(int argc,char* argv[])
{
    if(argc!=3){
        std::cout<<"Usage: ./udpserver serverip serverport\n";
        return 1;
    }
    UdpClient client(argv[1],atoi(argv[2]));
    for(;;){
        std::string resp;
        std::string req;
        std::cout<<"请输入你要查找的单词：";
        std::cin>>req;
        if(!std::cin){
            std::cout<<"Good Bye\n";
            break;
        }
        client.Sendto(req);
        client.Recvfrom(&resp);
        printf("单词：%s   翻译为：%s\n",req.c_str(),resp.c_str());
    }
    return 0;
}